Add store-scoped payment management to Grand.Web.Store#714
Merged
Conversation
Adds a PaymentController to the store-manager panel mirroring the Admin
payment configuration, scoped to the store owner (CurrentStoreId), following
the existing Store ShippingController conventions:
- Payment methods: list providers and toggle active per store
- Payment settings: store-scoped PaymentSettings toggles
- Payment restrictions: by country / shipping method, per store
Payment restrictions were stored globally (setting keys
PaymentMethodRestictions.{SystemName} / ...Shipping.{SystemName} with no
storeId). To support true per-store isolation, the four restriction methods on
IPaymentService/PaymentService now take an optional storeId (default ""), which
is threaded into ISettingService (store-specific read with global fallback,
per-store write) and into LoadActive/LoadAllPaymentMethods so restrictions
apply per store at checkout. The default keeps Admin behaviour unchanged.
Plugin configuration links are intentionally deferred to a separate task.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Type: feature
Issue
The store-manager panel (
Grand.Web.Store) already mirrors many Admin configuration areas in a store-scoped way (Shipping, Tax, GiftVoucher, Discount, ContactAttribute), but payment configuration was missing — it lived only inGrand.Web.Admin. A store owner had no way to manage payment methods, payment settings, or payment restrictions for their own store.Solution
Adds a store-scoped
PaymentControllertoGrand.Web.Store, following the existing StoreShippingControllerconventions (primary-constructor DI,CurrentStoreIdfromStaffStoreId,[PermissionAuthorize(PermissionSystemName.PaymentMethods)]+ action-level permissions). It provides the three capabilities requested:PaymentSettings.ActivePaymentProviderSystemNames).PaymentSettingstoggles.Payment settings and active methods were already store-scoped via
ISettingService+PaymentSettings. Payment restrictions, however, were stored globally (setting keysPaymentMethodRestictions.{SystemName}/...Shipping.{SystemName}with nostoreId), unlike shipping restrictions which live on the store-scopedShippingMethodentity. To get true per-store isolation, the four restriction methods onIPaymentService/PaymentServicenow accept an optionalstring storeId = "", which is threaded into:ISettingService.GetSettingByKey(..., storeId)— store-specific read with fallback to the global value.ISettingService.SetSetting(..., storeId)— writes a per-store setting row.LoadActivePaymentMethods/LoadAllPaymentMethods— so restrictions apply per store at checkout.Views live in
Areas/Store/Views/Payment/(Index grid, Settings, MethodRestrictions + Country/Shipping tab partials), reusing the existingGrand.Web.AdminSharedpayment models/mappers. The Store sidebar reuses the sharedAdminSiteMap, which already contains the Payment node, so no sitemap change was needed.Plugin configuration links (gateway credentials via each provider's
ConfigurationUrl) are intentionally out of scope here and deferred to a separate task; the Store methods grid shows the list + active toggle only.Breaking changes
None. The new
storeIdparameters onIPaymentServiceare optional and default to"", so the existing AdminPaymentControllerand all other callers keep their current global behaviour unchanged.Testing
dotnet build) — Admin and Store both compile.Manage payment methodspermission to the store manager customer group (Customers → Customer groups → store manager → ACL). Note: this permission is not part of the default store-manager set (consistent with howShippingSettings/TaxSettingswere added)./store) as a store manager. Confirm a Payment item appears in the sidebar with Payment methods, Payment settings, and Payment method restrictions.store/payment, toggle a provider active, reload, and confirm it persists. Verify thePaymentSettingsSettingrecord carries the manager'sStoreId(store-scoped, not global).paymentmethodrestictions.*/paymentmethodrestictionsshipping.*Settingrow is written with the manager'sStoreId, leaving any global row untouched.🤖 Generated with Claude Code